<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
        >

    <p:dialog header="Adauga/Editeaza salariu" widgetVar="add_salary_WV" dynamic="true"
              minHeight="300" width="600" modal="true" closeOnEscape="true">

        <h:form id="create_salary_form">

            <h:panelGrid columns="2" columnClasses="column-1, column-200" styleClass="form-elements">

                <p:outputLabel for="salary_level" value="Gradul de salarizare:"/>
                <p:selectOneMenu id="salary_level" value="#{employmentDataBean.selectedSalary.salaryLevel}" required="true"
                                 style="width: 200px;" converter="#{objectMappingConverter}">
                    <f:selectItem itemLabel="Selectati ..."/>
                    <f:selectItems var="sl" value="#{employmentDataBean.salaryLevels}"
                                   itemLabel="#{sl.name}"
                                   itemValue="#{sl}"/>
                </p:selectOneMenu>

                <p:outputLabel for="salary_step" value="Treapta de salarizare:"/>
                <p:selectOneMenu id="salary_step" value="#{employmentDataBean.selectedSalary.salaryStep}"
                                 required="true"
                                 style="width: 200px;" converter="#{objectMappingConverter}">
                    <f:selectItem itemLabel="Selectati ..."/>
                    <f:selectItems var="ss" value="#{employmentDataBean.salarySteps}" itemLabel="#{ss.name}"
                                   itemValue="#{ss}"/>
                </p:selectOneMenu>

                <p:outputLabel for="salary_amount" value="Salariu de functie:"/>
                <p:inputText id="salary_amount" value="#{employmentDataBean.selectedSalary.amount}" required="true"/>

                <p:outputLabel for="salary_establishment" value="Data stabilirii:"/>
                <p:calendar id="salary_establishment" value="#{employmentDataBean.selectedSalary.establishmentDate}"
                            required="true" pattern="dd/MM/yyyy"/>
            </h:panelGrid>

            <p:outputPanel layout="block" style="border-top: 1px solid #A8A8A8; padding: 5px;">
                <p:commandButton icon="ui-icon-disk" value="Salveaza"
                                 update="@form :folder_details_content:folder_details_content:salaries_form"
                                 actionListener="#{employmentDataBean.saveSalary}"
                                 oncomplete="if (args &amp;&amp; !args.validationFailed) add_salary_WV.hide()"/>
                <p:commandButton value="Renunta" onclick="PF('add_salary_WV').hide();" process="@none"/>
            </p:outputPanel>
        </h:form>
    </p:dialog>


</ui:composition>
